function save(record,filename)
% save to file
fid = fopen(filename,'w');
time = record.time;
mean = record.mean;
var = record.var;
for i=1:length(time)
    fprintf(fid,'%15.3f%15.6e%15.6e\n',time(i),mean(i),var(i));
end
end